package com.dbgs.insurance.insuredperson.activity.apply;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.dbgs.insurance.insuredperson.R;
import com.dbgs.insurance.insuredperson.constants.ConstInt;
import com.hss.base.BaseActivty;
import com.leon.lib.settingview.LSettingItem;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ContactPersonInfoActivity extends BaseActivty {
    @BindView(R.id.btn_tite_back)
    Button btnTiteBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_tite_right)
    TextView tvTiteRight;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.name)
    AppCompatTextView name;
    @BindView(R.id.name_tv)
    AppCompatEditText nameTv;
    @BindView(R.id.sex)
    AppCompatTextView sex;
    @BindView(R.id.btn_man)
    RadioButton btnMan;
    @BindView(R.id.btn_woman)
    RadioButton btnWoman;
    @BindView(R.id.sex_rg)
    RadioGroup sexRg;
    @BindView(R.id.id_num)
    AppCompatTextView idNum;
    @BindView(R.id.id_num_tv)
    AppCompatEditText idNumTv;
    @BindView(R.id.id_phone_no)
    AppCompatTextView idPhoneNo;
    @BindView(R.id.id_phone_no_tv)
    AppCompatEditText idPhoneNoTv;
    @BindView(R.id.relationship_with_nsured)
    LSettingItem relationshipWithNsured;
    @BindView(R.id.select_address)
    LSettingItem selectAddress;
    @BindView(R.id.next_step_btn)
    AppCompatTextView nextStepBtn;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contact_info);
        ButterKnife.bind(this);
        initData();
        initView();
        initListener();
    }

    @Override
    public void initView() {
        super.initView();
        tvTitle.setText(R.string.str_need_apply_3);
    }

    @OnClick({R.id.btn_tite_back, R.id.next_step_btn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_tite_back:
                exit();
                break;
            case R.id.next_step_btn:
                startActyForResult(ApplySuccessActivity.class,ConstInt.REQUEST_INSUREDPERSONAPPLY_CODE);
                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode==ConstInt.REQUEST_INSUREDPERSONAPPLY_CODE && resultCode==ConstInt.RESULT_VALUE_CHANGED){
            setResult(resultCode);
            exit();
        }
    }
}
